﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ERP_RORZE_TOOL.Common;

namespace ERP_RORZE_PRODUCT.Product.PartData
{
    public partial class frm_UpdateReportOptionData : Form
    {

        private string table = "Table: OptionData\r\n";
        private string time = "Time update: " + DateTime.Now.ToString() + "\r\n";
        private string okStr = "Import successfully: ";
        private string errStr = "Import error: ";

        public frm_UpdateReportOptionData(List<Utilities.OptionDataUpdateItem> ok, List<Utilities.OptionDataUpdateItem> err)
        {
            InitializeComponent();

            //add Ok
            okStr += ok.Count + " records \r\n";
            okStr += "   PartID | OptionID | ProTime | UpdateDay | StaffID\r\n";
            foreach (Utilities.OptionDataUpdateItem item in ok)
            {
                okStr += "   " + item.PartNo() + " | " + item.OptionID() + " | " + item.ProTime() + " | " + item.UpdateDay() + " | " + item.StaffID() + "\r\n";
            }
            okStr += "\r\n";

            //add error
            errStr += err.Count + " records \r\n";
            errStr += "   PartID | OptionID | ProTime | UpdateDay | StaffID\r\n";
            foreach (Utilities.OptionDataUpdateItem item in err)
            {
                errStr += "   " + item.PartNo() + " | " + item.OptionID() + " | " + item.ProTime() + " | " + item.UpdateDay() + " | " + item.StaffID() + "\r\n";
            }
            errStr += "\r\n";


            memoEdit1.Text = table + time + "Total rows: " + (ok.Count  + err.Count).ToString() + "\r\n\r\n" + okStr + errStr;
            memoEdit1.Visible = true;
        }
    }
}
